//ObjectComparable.java
package com.xyc.ch7;

class A3  implements Comparable
{
	int i,j;
	public A3(int a1,int a2)
	{
		i=a1;
		j=a2;
	}
	public int compareTo(Object obj)
	{
		int k=((A3)obj).j;
		if(k>j)
			return -1;
		else if(k<j)
			return 1;
		else
			return 0;
	}
	public String toString()
	{
		return "("+i+","+j+")";
	}
}

public class ObjectComparable
{
	public static void main(String[] args)
	{
		A3 a1=new A3(2,4);
		A3 a2=new A3(5,3);
		if(a1.compareTo(a2)>0)
			System.out.println(a1+">"+a2);
		else if(a1.compareTo(a2)<0)
			System.out.println(a1+"<"+a2);
		else
			System.out.println(a1+"=="+a2);
	}
}



